return "LOOP FOR X SECONDS: FRAME BEHAVIOR" & RETURN & RETURN & "This behavior will make the playback head loop for a fixed length of time over a certain number of frames, then jump to a chosen marker. " & "You can choose whether the playback head jumps immediately at the end of the period, or whether it should run right through to the last frame of the span." & RETURN & RETURN & "Drag this behavior to the frame channel of the Score Window, then stretch it out over the frames you wish to loop over. " & "If you wish to remain on the same frame, then simply do not stretch out the sprite." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "Frame behavior" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Duration of loop (1 tick - 120 hours)" & RETURN & "* Marker to jump to at the end of the period" & RETURN & "* Playback head jumps immediately | at the end of the cycle"
end
on getBehaviorTooltip me
return "Frame behavior. " & "Stretch this behavior over a sequence of frames to make the playback head loop for a fixed length of time then jump to a chosen marker. " & "Option: ensure that the cycle is fully completed before the playback head jumps."
end
on beginSprite me
Initialize(me)
end
on exitFrame me
CheckTimeOut(me)
end
on Initialize me
thisSprite = sprite(the currentSpriteNum)
myStartFrame = thisSprite.startFrame
myEndFrame = thisSprite.endFrame
if symbolp(myTimeOutFrame) then
case myTimeOutFrame of
#previous:
jumpToFrame = marker(-1)
#loop:
jumpToFrame = marker(0)
#next:
jumpToFrame = marker(1)
end case
else
jumpToFrame = marker(myTimeOutFrame)
end if
if the currentSpriteNum then
ErrorAlert(me, #invalidChannel, the currentSpriteNum)
end if
if not jumpToFrame then
jumpToFrame = myEndFrame + 1
ErrorAlert(me, #missingMarker, jumpToFrame)
else
if (jumpToFrame >= myStartFrame) and (jumpToFrame <= myEndFrame) then
terror1 = substituteStrings(me, terror1, ["^0": the frame, "^1": the currentSpriteNum])
terror2 = "Frame behavior ^0 is set to jump to marker ^1. " & "This marker cannot be found. " & " Choose a valid marker in the Behavior Parameters dialog."